package com.e3.basdoc.region.service;

import java.util.List;

import com.e3.basdoc.region.model.RegionModel;
import com.e3.core.base.ModelCacheManager;

public class RegionCacheManager extends ModelCacheManager<RegionModel>{
	
	public final static String REGION_CACHE = "REGION_CACHE";
	
	public static RegionCacheManager INSTANCE = new RegionCacheManager();
	
	public void put(RegionModel model){
		putModel(REGION_CACHE, model);
		RegionModel pModel = model.getParentModel();
		if(pModel!=null){
			RegionModel pcModel = get(pModel.getId());
			if(pcModel!=null){
				pcModel.setHasChildren(true);
			}
		}
	}

	public RegionModel get(Long id) {
		return getModel(REGION_CACHE, id);
	}
	
	public void remove(List<Long> ids){
		removeModels(REGION_CACHE,ids);
	}

}
